측정 지표 API는 Prometheus 같은 외부 모니터링 시스템에 Trilium 상태를 제공합니다.
GET /etapi/metrics로 요청합니다. ETAPI 토큰이 필요하며 기본 응답은 Prometheus 텍스트 형식입니다.
# ETAPI 토큰 발급 예시
curl -X POST http://localhost:8080/etapi/auth/login \
-H "Content-Type: application/json" \
-d '{"password": "your_password"}'
curl -H "Authorization: YOUR_ETAPI_TOKEN" \
http://localhost:8080/etapi/metrics
다음과 같은 형식으로 응답합니다. 지표 이름과 형식은 연동을 위해 유지합니다.
# HELP trilium_info Trilium 인스턴스 정보
# TYPE trilium_info gauge
trilium_info{version="0.91.6",db_version="231",node_version="v18.17.0"} 1 1701432000
# HELP trilium_notes_total 삭제된 노트를 포함한 전체 노트 수
# TYPE trilium_notes_total gauge
trilium_notes_total 1234 1701432000
JSON으로 받으려면 다음처럼 요청합니다.
curl -H "Authorization: YOUR_ETAPI_TOKEN" \
"http://localhost:8080/etapi/metrics?format=json"
trilium_info — 버전과 빌드 정보trilium_notes_total — 삭제된 노트를 포함한 전체 노트 수trilium_notes_deleted — 삭제된 노트 수trilium_notes_active — 활성 노트 수trilium_notes_protected — 보호 노트 수trilium_attachments_total — 전체 첨부 파일 수trilium_attachments_active — 활성 첨부 파일 수trilium_revisions_total — 수정 이력 수trilium_branches_total — 활성 가지 수trilium_attributes_total — 활성 속성 수trilium_blobs_total — 본문 데이터 레코드 수trilium_etapi_tokens_total — 활성 ETAPI 토큰 수trilium_embeddings_total — 노트 임베딩 수trilium_notes_by_type — 유형별 노트 수. type 라벨로 구분합니다.trilium_attachments_by_type — MIME 유형별 첨부 파일 수. mime_type 라벨로 구분합니다.trilium_database_size_bytes — 데이터베이스 크기. 바이트 단위입니다.trilium_oldest_note_timestamp — 가장 오래된 노트의 시각trilium_newest_note_timestamp — 가장 최근 노트의 시각trilium_last_modified_timestamp — 마지막 수정 시각prometheus.yml에 추가할 예시입니다.
scrape_configs:
- job_name: 'trilium'
static_configs:
- targets: ['localhost:8080']
metrics_path: '/etapi/metrics'
bearer_token: 'YOUR_ETAPI_TOKEN'
scrape_interval: 30s
400은 지원하지 않는 format 값입니다. 401은 토큰이 없거나 유효하지 않다는 뜻이며 500은 서버 내부 오류입니다.

Grafana 대시보드 JSON을 가져오기 화면에 입력하세요.

JSON을 붙여넣고 불러오기를 누릅니다.
